package com.cloudys.dao;

import com.cloudys.bean.TestUser;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import javax.persistence.Table;

@Repository
@Table(name="test_user")
@Qualifier("testUserRepositoryDao")
public interface TestUserRepositoryDao extends CrudRepository<TestUser,Long> {

    @SuppressWarnings("unchecked")
    public TestUser save(TestUser u);

    @Query("select t from TestUser t where t.name=:name")
    public TestUser findUserByName(@Param("name") String name);

}
